#!/bin/bash
f=Makefile
source_dir=$1/src
build_dir=$1/build

mkdir ${source_dir} -p

#files
main_c=${source_dir}/main.c
func_c=${source_dir}/$1.c
header=${source_dir}/$1.h

#include header
include_pp_command="#include \"$1.h\""
echo ${include_pp_command} >> ${main_c}
echo "int main(int argc, const char *argv[]){}" >> ${main_c}
echo ${include_pp_command} >> ${func_c}

#basic framework for the header
echo "#include <stdio.h>" >> ${header}
macro=_${1^^}_H_
echo "#ifndef ${macro}" >>${header}
echo "#define ${macro}" >>${header}
echo >>${header}
echo "#endif" >>${header}

#build dir
mkdir ${build_dir} -p

#generate makefile
touch $1/$f
echo "TARGET=$1" >> $1/$f
cat ~/debian/dev/c/blueprint >> $1/$f
# touch $1/main.c
# touch $1/$1.c
# touch $1/$1.h
